//
//  ZMMenuButton.swift
//  ZMWeiboSwift
//
//  Created by pg on 2017/7/29.
//  Copyright © 2017年 pg. All rights reserved.
//

import UIKit

class ZMMenuButton: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        imageView?.contentMode = .center
        titleLabel?.textAlignment = .center
    }
   
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //MARK:- 布局子空间
    override func layoutSubviews() {
        super.layoutSubviews()
        
        imageView?.frame.size.width = self.bounds.width
        imageView?.frame.size.height = self.bounds.width
        imageView?.frame.origin.y = 0
        
        
        titleLabel?.frame.size.width = self.bounds.width
        titleLabel?.frame.size.height = self.bounds.height - self.bounds.size.width
        titleLabel?.frame.origin.x = 0
        titleLabel?.frame.origin.y = self.bounds.width
        
        
        
    }
    
    
    

}
